/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.reg;

import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * <p>Project: jse2302 - RegExp5
 * <p>Powered by webrx On 2023-06-20 14:47:48
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class RegExp5 {
    public static void main(String[] args) {
        String ws = """
                Lorem -javascript      --java-A ipsum  dolor sit amet, consectetur adipisicing elit. Voluptate numquam rerum explicabo ut similique accusamus esse!
                """;
        Pattern p = Pattern.compile("[a-zA-Z]+");
        //System.out.println(p.pattern());


        Matcher m = p.matcher(ws);
        StringBuilder sbu = new StringBuilder();
        while(m.find()){
            sbu.append(String.format("%s,",m.group()));
            //System.out.println(m.group());
        }
        sbu.delete(sbu.length()-1,sbu.length());
        String[] w = sbu.toString().split(",");
        System.out.println(Arrays.toString(w));
    }
}
